package P1909;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int minPrice=0;
        double num;
        int pencilNum = sc.nextInt();
        int[][] pencilKind = new int[3][2];
        for (int i = 0; i < 3; ++i) {
            for (int j = 0; j < 2; ++j){
                pencilKind[i][j] = sc.nextInt();
            }
            num = Math.ceil((pencilNum+0.0) / pencilKind[i][0]);
            pencilKind[i][1] *= num;
        }
        minPrice = (pencilKind[0][1] >= pencilKind[1][1])? ((pencilKind[2][1] >= pencilKind[1][1])?pencilKind[1][1]:pencilKind[2][1]) :((pencilKind[0][1] >= pencilKind[2][1])?pencilKind[2][1]:pencilKind[0][1]);
        System.out.println(minPrice);
    }
}
